package com.cnswhy.cloud.server.core.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.cnswhy.cloud.common.core.base.entity.Entity;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.Accessors;
import static com.cnswhy.cloud.common.core.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 实体类
 * 轮播图表
 * </p>
 *
 * @author cnswhy
 * @since 2020-10-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("t_slideshow")
@ApiModel(value = "Slideshow", description = "轮播图表")
@AllArgsConstructor
public class Slideshow extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 标题
     */
    @ApiModelProperty(value = "标题")
    @NotEmpty(message = "标题不能为空")
    @Length(max = 500, message = "标题长度不能超过500")
    @TableField(value = "title", condition = LIKE)
    @Excel(name = "标题")
    private String title;

    /**
     * 排序
     */
    @ApiModelProperty(value = "排序")
    @NotNull(message = "排序不能为空")
    @TableField("serial_num")
    @Excel(name = "排序")
    private Integer serialNum;

    /**
     * 广告链接
     */
    @ApiModelProperty(value = "广告链接")
    @Length(max = 500, message = "广告链接长度不能超过500")
    @TableField(value = "link", condition = LIKE)
    @Excel(name = "广告链接")
    private String link;

    /**
     * 状态：0-生效 1-失效 2-删除
     */
    @ApiModelProperty(value = "状态：0-生效 1-失效 2-删除")
    @Length(max = 1, message = "状态：0-生效 1-失效 2-删除长度不能超过1")
    @TableField(value = "status", condition = LIKE)
    @Excel(name = "状态：0-生效 1-失效 2-删除")
    private String status;

    /**
     * 0首页1首页banner2商城banner
     */
    @ApiModelProperty(value = "0首页1首页banner2商城banner")
    @NotNull(message = "0首页1首页banner2商城banner不能为空")
    @TableField("type")
    @Excel(name = "0首页1首页banner2商城banner")
    private Integer type;

    /**
     * 图片地址
     */
    @ApiModelProperty(value = "图片地址")
    @NotEmpty(message = "图片地址不能为空")
    @Length(max = 2000, message = "图片地址长度不能超过2000")
    @TableField(value = "url", condition = LIKE)
    @Excel(name = "图片地址")
    private String url;

    /**
     * 创建日期
     */
    @ApiModelProperty(value = "创建日期")
    @TableField("create_date")
    @Excel(name = "创建日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime createDate;

    /**
     * 修改日期
     */
    @ApiModelProperty(value = "修改日期")
    @TableField("update_date")
    @Excel(name = "修改日期", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime updateDate;


    @Builder
    public Slideshow(Long id, LocalDateTime createTime, LocalDateTime updateTime, Long createUser, Long updateUser, 
                    String title, Integer serialNum, String link, String status, Integer type, 
                    String url, LocalDateTime createDate, LocalDateTime updateDate) {
        this.id = id;
        this.createTime = createTime;
        this.updateTime = updateTime;
        this.createUser = createUser;
        this.updateUser = updateUser;
        this.title = title;
        this.serialNum = serialNum;
        this.link = link;
        this.status = status;
        this.type = type;
        this.url = url;
        this.createDate = createDate;
        this.updateDate = updateDate;
    }

}
